<template>
  <div style="margin-right: 0; margin-left: auto;">
    <div class="but" ref="dhapp" @click="showCode()">下载帮帮同城app</div>
    <transition name="el-fade-in">
      <div class="erweima" v-if="ewmStatus" :style="{
        top: (setTop ? setTop : top) + 'px',
        right: (setRight ? setRight : right) + 'px'
      }">
        <div><img src="../../../assets/android.png" /><span>安卓</span></div>
        <div><img src="../../../assets/iosDown.png" /><span>IOS</span></div>
        <i class="el-icon-close" style="
            cursor: pointer;
            position: absolute;
            top: 3px;
            color: #000;
            font-size: 24px;
            right: 6px;
          " @click="yc()"></i>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  name: "titlesearch",
  props: {
    setTop: {
      type: String
    },
    setRight: {
      type: String
    }
  },
  data() {
    return {
      searchtext: "",
      ewmStatus: false,
      right: 0,
      top: 108
    };
  },
  methods: {
    shouye() {
      this.$router.push({
        path: "/"
      });
    },
    search() {
      this.openUrl({
        path: "/index/houseSearch",
        query: {
          search: this.searchtext
        }
      });
    },
    showCode() {
      var dom = this.$refs.dhapp;
      console.dir(this.$refs.dhapp);
      // console.log(dom.offsetLeft,dom.offsetTop,dom.offsetWidth);

      this.right =
        1200 - dom.offsetLeft - dom.offsetWidth
          ? 1200 - dom.offsetLeft - dom.offsetWidth < 0
            ? -(1200 - dom.offsetLeft - dom.offsetWidth)
            : 1200 - dom.offsetLeft - dom.offsetWidth
          : 0;
      this.top = dom.offsetTop * 2 + 50 + 8 || 108;
      this.$nextTick(function () {
        this.ewmStatus = !this.ewmStatus;
      });
    },
    yc() {
      console.log(222);
      this.ewmStatus = false;
    }
  }
};
</script>

<style lang="less" scoped>
.tit {
  width: 100%;
  height: 100px;
  background-color: #f2f2f2;

  .list {
    position: relative;
    width: 1200px;
    margin-left: 50%;
    padding-top: 25px;
    transform: translateX(-50%);
    background-color: #f2f2f2;

    div {
      display: inline-block;
      vertical-align: middle;
      font-size: 20px;
      color: #333333;
    }

    .li {
      cursor: pointer;
      font-size: 28px;
      color: #64b6a8;
      margin-right: 60px;

      img {
        /* width: 60px;
	        height: 60px; */
      }

      span {
        vertical-align: middle;
      }
    }

    .rig {
      position: absolute;
      right: 0;

      .sousuo {
        position: relative;
        display: block;
        width: 380px;
        height: 50px;
        background: #ffffff;
        border-radius: 4px;
        font-size: 18px;
        overflow: hidden;
        display: inline-block;

        input {
          width: 300px;
          height: 55px;
          line-height: 55px;
          text-indent: 16px;
          font-size: 18px;
        }

        img {
          width: 25px;
          height: 25px;
          margin-left: 20px;
          cursor: pointer;
        }

        p {
          position: absolute;
          top: 0;
          right: 0;
          width: 80px;
          height: 55px;
          background-color: #64b6a8;
          text-align: center;
          line-height: 55px;
          font-size: 24px;
          cursor: pointer;
          color: #ffffff;
        }
      }

      .but {
        // position: relative;

        width: 200px;
        height: 50px;
        background: #64b6a8;
        border-radius: 6px;
        text-align: center;
        line-height: 50px;
        color: #fff;
        margin-left: 0 !important;
      }
    }
  }
}

.erweima {
  position: fixed;
  right: 0;
  top: 108px;
  z-index: 9999999;
  background-color: #f7f0f0;
  padding: 20px;
  border-radius: 5px;
  display: flex !important;

  //   margin-right: 10px !important;
  div {
    margin-right: 10px !important;
    z-index: 99999;
    display: flex !important;
    flex-direction: column;
    align-items: center;

    img {
      width: 150px;
      height: 150px;
    }

    span {
      color: #000;
    }
  }
}

.but {
  //       position: absolute;
  // right: 0;
  width: 200px;
  // top: 50%;

  height: 50px;
  background: #64b6a8;
  border-radius: 6px;
  text-align: center;
  line-height: 50px;
  color: #fff !important;
  margin-left: 0 !important;
  cursor: pointer;

  display: inline-block;
  vertical-align: middle;
  font-size: 20px;
}</style>
